//app.js
App({
  onLaunch: function () {
  var storageData=wx.getStorageSync('postList');
  if (!storageData){
    var dataObj=require('data/data.js')
    wx.clearStorageSync();
    wx.setStorageSync('postList', dataObj.postList);
  }
  this._getUserInfo();
  },
  _getUserInfo:function(){
  var userInfoStorage=wx.getStorageSync('user');
  if(!userInfoStorage){
    var self=this;
    wx.login({
      success:function(){
        wx.getUserInfo({
          success:function(res){
            self.globalData.g_userInfo=res.userInfo
          wx.setStorageSync('user', res.userInfo)
          }
        })
      }
    })
  }else{
    this.globalData.g_userInfo = userInfoStorage;  
  }
  },
  globalData: {
    userInfo: null,
    isplay:false,
    artcleId:'',
    g_userInfo: null,
    doubanBase:"http://t.yushu.im"
  }
})